<template>
  <view style="background-color: #181816; height: 100%;">
    <view class="success_icon">
      <image src="../../static/successed.png"></image>
    </view>
    <view class="success_text">区块链地址</view>
    <view class="sub_text">区块链上持有藏品唯一地址</view>
    <view class="nft_address">
      <view class="address_text">至信链</view>
      <view class="address_box" @click="copy(nft_address)">
        {{ nft_address }}
        <image
          src="../../static/copy.png"
          style="
            width: 36rpx;
            height: 36rpx;
            margin-left: 40rpx;
            vertical-align: middle;
          "
          @click="copy(nft_address)"
        ></image>
      </view>
    </view>
    <view class="support_host">
      <!-- 至信链 -->
      <view class="ZXL">
        <image src="../../static/zxl_logo.png"></image>
      </view>
      
    </view>
	<!-- 经营许可 -->
	<view class="ICP">ICP经营许可 京B2-20221836号</view>
  </view>
</template>

<script>
import api from '@/request/api.js'
import login from '@/common/login.js'
export default {
  data() {
    return {
      statusBarHeight: 0,
      titleBarHeight: 0,
      screenHeight: 0,
      phone: '',
      real_name: '',
      id_num: '',
      nft_address: '',
      token: '',
      show_success: false,
      show_error: false,
	  ua:''
    }
  },
  mounted() {
    if (!this.ua) return
    document.getElementsByClassName('uni-page-head__title')[0].style.display = 'none'
  },
  onLoad(option) {
	  const ua = window.navigator.userAgent.toLowerCase()
	  this.ua = ua.match(/MicroMessenger/i) == 'micromessenger'
    let userInfo = uni.getStorageSync('userInfo')
    let token = userInfo.token
    let uid = userInfo.uid
    this.token = token
    this.uid = uid
    /* 获取区块链地址 */
    const nft_address = option.nft_address
    this.nft_address = nft_address
    console.log(nft_address)
    /* 获取屏幕高度 */
    uni.getSystemInfo({
      success: (res) => {
        this.screenHeight = res.screenHeight * (750 / res.windowWidth) //将px 转换rpx
        console.log(this.screenHeight)
      },
    })
    // 判断用户是否登录
    if (token == '') {
      console.log(111)
      /* 提示用户需要登录操作 */
      uni.showModal({
        title: '提示',
        content: '请先登录再进行操作',
        success: (res) => {
          if (res.confirm) {
            console.log('用户点击确定')
            /* 调起登录 */
            uni.navigateBack()
          } else if (res.cancel) {
          }
        },
      })
    } else {
      if (userInfo.nft_address == null || userInfo.nft_address == '') {
        let nft_address = uni.getStorageSync('nft_address')
        this.nft_address = nft_address
      } else {
        this.nft_address = userInfo.nft_address
      }
    }
  },
  methods: {
    // 复制到剪切板
    copy(text) {
      uni.setClipboardData({
        data: text,
        success: (res) => {
          uni.showToast({
            title: '已复制到剪切板',
            icon: 'none',
          })
        },
      })
    },
  },
}
</script>

<style lang="scss">
page {
  height: 100%;
  background-color: #181816;
}
.success_icon {
  width: 120rpx;
  height: 86rpx;
  margin: auto;
  padding-top: 90rpx;

  image {
    width: 100%;
    height: 100%;
  }
}

.success_text {
  margin: 30rpx auto;
  font-family: PingFang-SC-Medium;
  font-size: 30rpx;
  color: #ffffff;
  text-align: center;
}
.sub_text{
	margin: auto;
	font-family: PingFang-SC-Medium;
	font-size: 24rpx;
	color: #ccc;
	text-align: center;
}
.nft_address {
  margin-top: 60rpx;

  .address_text {
    width: 90%;
	margin: auto;
    font-family: PingFang-SC-Medium;
    font-size: 24rpx;
    line-height: 18rpx;
    color: #ffffff;
    opacity: 0.73;
    text-align: left;
    color: #ffffff;
  }

  .address_box {
    width: 700rpx;
    height: 100rpx;
    margin: 30rpx auto;
    font-size: 24rpx;
    line-height: 100rpx;
    background-color: #282a2c;
    border-radius: 20rpx;
    text-align: center;
    color: #ffffff;
  }
}

.support_host {
  width: 40%;
  margin: 500rpx auto 0 auto;

  .ZXL {
    width: 100%;

    image {
      height: 70rpx;
      width: 100%;
    }
  }

  
}
.ICP {
    font-size: 20rpx;
    color: #999999;
    text-align: center;
  }
</style>
